import java.util.TreeSet;

public class Treee {
    public static void main(String[] args){
        //排序方式：Student实现Compareable接口，重写里面的抽象方法，再排序

        //1.创建对象
        Student s1=new Student(23,"zhangsan");
        Student s2=new Student(24,"lisi");
        Student s3=new Student(21,"wangwu");
        //创建集合
        TreeSet<Student> ts=new TreeSet<>();
        //3.添加元素
        ts.add(s3);
        ts.add(s2);
        ts.add(s1);


        System.out.println(ts);


    }
}
